package com.itboye.ihomebank.ttKey;


import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * 数据库锁数据
 */
public class Key  implements Parcelable,Serializable{
    private Long id;
    private String accessToken;//访问令牌
    @SerializedName("key_id")
    private String lockId;//锁id
    private String keyId;//钥匙id
    private boolean isAdmin;//是否是管理员
    private String lockVersion;//锁版本信息 json格式
    private String lockName;//锁名称
    private String lockAlias;//锁别名
    private String lockMac;//锁mac地址
    private int battery;//电量
    private int lockFlagPos;//锁标志位
    private String adminPs;// 锁数据,直接传就行
    private String unlockKey;//锁数据. 直接传就行
    private String adminKeyboardPwd;//管理码
    private String deletePwd;//删除码
    private String pwdInfo;//密码数据信息
    private long timestamp;//时间戳
    private String aesKeystr;//aesKey
    private long startDate;//开始时间
    private long endDate;// 结束时间
    private int specialValue;//锁特征值，用于表示锁支持的功能
    private int timezoneRawOffset;//不考虑时区问题传入-1即可,锁所在时区和UTC时区时间的差数，单位milliseconds，默认28800000（中国时区）
    private String modelNumber;//锁型号
    private String hardwareRevision;//锁硬件版本号
    private String firmwareRevision;//锁固件版本号

    private String keyStatus;//使用情况

    private String user_type;//用户类型,0=>管理者，1=>授权用户
    private String status;//钥匙状态  "110401"	正常使用   110402"	待接收  "110405"	已冻结 "110405"	已冻结 "110408"	已删除"     110410"	已重置
    private String push;//是1否0开了开锁推送
    private String house_no;//绑定房源

    @SerializedName("type")
    private String types; //钥匙类型,0=>管理员，1=>用户

    private String lock_type;//鎖類型-白马锁（6587）  科技侠（其他）

    @SerializedName("hasValidRent")
    private String  has_valid_rent;//0管理员能开门,其他管理员不能开门,因为有合法租户了,
    private String  reset_rent_pass;//是(1)否(0)需要清空租户密码,租户钥匙有效



    public Key(Long id, String accessToken, String keyStatus, String lockId, String keyId, boolean isAdmin, String lockVersion, String lockName,
               String lockAlias, String lockMac, int battery, int lockFlagPos, String adminPs, String unlockKey, String adminKeyboardPwd, String deletePwd,
               String pwdInfo, long timestamp, String aesKeystr, long startDate, long endDate, int specialValue, int timezoneRawOffset, String modelNumber,
               String hardwareRevision, String firmwareRevision, String user_type, String status, String push, String house_no, String types, String lock_type
              , String has_valid_rent, String reset_rent_pass) {
        this.id = id;
        this.accessToken = accessToken;
        this.keyStatus = keyStatus;
        this.lockId = lockId;
        this.keyId = keyId;
        this.isAdmin = isAdmin;
        this.lockVersion = lockVersion;
        this.lockName = lockName;
        this.lockAlias = lockAlias;
        this.lockMac = lockMac;
        this.battery = battery;
        this.lockFlagPos = lockFlagPos;
        this.adminPs = adminPs;
        this.unlockKey = unlockKey;
        this.adminKeyboardPwd = adminKeyboardPwd;
        this.deletePwd = deletePwd;
        this.pwdInfo = pwdInfo;
        this.timestamp = timestamp;
        this.aesKeystr = aesKeystr;
        this.startDate = startDate;
        this.endDate = endDate;
        this.specialValue = specialValue;
        this.timezoneRawOffset = timezoneRawOffset;
        this.modelNumber = modelNumber;
        this.hardwareRevision = hardwareRevision;
        this.firmwareRevision = firmwareRevision;
        this.user_type = user_type;
        this.status = status;
        this.push = push;
        this.house_no = house_no;
        this.types = types;
        this.lock_type=lock_type;
        this.has_valid_rent=has_valid_rent;
        this.reset_rent_pass=reset_rent_pass;
    }

    public Key() {
    }
    public String getReset_rent_pass() {
        return reset_rent_pass;
    }

    public void setReset_rent_pass(String reset_rent_pass) {
        this.reset_rent_pass = reset_rent_pass;
    }
    public String getHas_valid_rent() {
        return has_valid_rent;
    }

    public void setHas_valid_rent(String has_valid_rent) {
        this.has_valid_rent = has_valid_rent;
    }

    public String getLock_type() {
        return lock_type;
    }

    public void setLock_type(String lock_type) {
        this.lock_type = lock_type;
    }

    public String getUser_type() {
        return user_type;
    }

    public void setUser_type(String user_type) {
        this.user_type = user_type;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPush() {
        return push;
    }

    public void setPush(String push) {
        this.push = push;
    }

    public String getHouse_no() {
        return house_no;
    }

    public void setHouse_no(String house_no) {
        this.house_no = house_no;
    }

    public String getTypes() {
        return types;
    }

    public void setTypes(String types) {
        this.types = types;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLockId() {
        return this.lockId;
    }

    public void setLockId(String lockId) {
        this.lockId = lockId;
    }

    public String getLockVersion() {
        return this.lockVersion;
    }

    public void setLockVersion(String lockVersion) {
        this.lockVersion = lockVersion;
    }

    public String getAdminPs() {
        return this.adminPs;
    }

    public void setAdminPs(String adminPs) {
        this.adminPs = adminPs;
    }

    public String getUnlockKey() {
        return this.unlockKey;
    }

    public void setUnlockKey(String unlockKey) {
        this.unlockKey = unlockKey;
    }

    public String getAdminKeyboardPwd() {
        return this.adminKeyboardPwd;
    }

    public void setAdminKeyboardPwd(String adminKeyboardPwd) {
        this.adminKeyboardPwd = adminKeyboardPwd;
    }

    public String getDeletePwd() {
        return this.deletePwd;
    }

    public void setDeletePwd(String deletePwd) {
        this.deletePwd = deletePwd;
    }

    public String getPwdInfo() {
        return this.pwdInfo;
    }

    public void setPwdInfo(String pwdInfo) {
        this.pwdInfo = pwdInfo;
    }

    public long getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getAesKeystr() {
        return this.aesKeystr;
    }

    public void setAesKeystr(String aesKeystr) {
        this.aesKeystr = aesKeystr;
    }

    public String getLockName() {
        return this.lockName;
    }

    public void setLockName(String lockName) {
        this.lockName = lockName;
    }

    public String getLockMac() {
        return this.lockMac;
    }

    public void setLockMac(String lockMac) {
        this.lockMac = lockMac;
    }

    public int getLockFlagPos() {
        return this.lockFlagPos;
    }

    public void setLockFlagPos(int lockFlagPos) {
        this.lockFlagPos = lockFlagPos;
    }

    public String getKeyId() {
        return this.keyId;
    }

    public void setKeyId(String keyId) {
        this.keyId = keyId;
    }

    public boolean isAdmin() {
        return this.isAdmin;
    }

    public void setAdmin(boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    @Override
    public String toString() {
        return "Key{" +
                "id=" + id +
                ", accessToken='" + accessToken + '\'' +
                ", lockId='" + lockId + '\'' +
                ", keyId='" + keyId + '\'' +
                ", isAdmin=" + isAdmin +
                ", lockVersion='" + lockVersion + '\'' +
                ", lockName='" + lockName + '\'' +
                ", lockAlias='" + lockAlias + '\'' +
                ", lockMac='" + lockMac + '\'' +
                ", battery=" + battery +
                ", lockFlagPos=" + lockFlagPos +
                ", adminPs='" + adminPs + '\'' +
                ", unlockKey='" + unlockKey + '\'' +
                ", adminKeyboardPwd='" + adminKeyboardPwd + '\'' +
                ", deletePwd='" + deletePwd + '\'' +
                ", pwdInfo='" + pwdInfo + '\'' +
                ", timestamp=" + timestamp +
                ", aesKeystr='" + aesKeystr + '\'' +
                ", startDate=" + startDate +
                ", endDate=" + endDate +
                ", specialValue=" + specialValue +
                ", timezoneRawOffset=" + timezoneRawOffset +
                ", modelNumber='" + modelNumber + '\'' +
                ", hardwareRevision='" + hardwareRevision + '\'' +
                ", firmwareRevision='" + firmwareRevision + '\'' +
                ", keyStatus='" + keyStatus + '\'' +
                ", user_type='" + user_type + '\'' +
                ", status='" + status + '\'' +
                ", push='" + push + '\'' +
                ", house_no='" + house_no + '\'' +
                ", types='" + types + '\'' +
                ", lock_type='" + lock_type + '\'' +
                ", has_valid_rent='" + has_valid_rent + '\'' +
                ", reset_rent_pass='" + reset_rent_pass + '\'' +
                '}';
    }

    public boolean getIsAdmin() {
        return this.isAdmin;
    }

    public int getBattery() {
        return this.battery;
    }

    public void setBattery(int battery) {
        this.battery = battery;
    }

    public String getAccessToken() {
        return this.accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public void setIsAdmin(boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    public long getStartDate() {
        return this.startDate;
    }

    public void setStartDate(long startDate) {
        this.startDate = startDate;
    }

    public long getEndDate() {
        return this.endDate;
    }

    public void setEndDate(long endDate) {
        this.endDate = endDate;
    }

    public int getSpecialValue() {
        return this.specialValue;
    }

    public void setSpecialValue(int specialValue) {
        this.specialValue = specialValue;
    }

    public int getTimezoneRawOffset() {
        return this.timezoneRawOffset;
    }

    public void setTimezoneRawOffset(int timezoneRawOffset) {
        this.timezoneRawOffset = timezoneRawOffset;
    }

    public String getModelNumber() {
        return this.modelNumber;
    }

    public void setModelNumber(String modelNumber) {
        this.modelNumber = modelNumber;
    }

    public String getHardwareRevision() {
        return this.hardwareRevision;
    }

    public void setHardwareRevision(String hardwareRevision) {
        this.hardwareRevision = hardwareRevision;
    }

    public String getFirmwareRevision() {
        return this.firmwareRevision;
    }

    public void setFirmwareRevision(String firmwareRevision) {
        this.firmwareRevision = firmwareRevision;
    }

    public String getLockAlias() {
        return this.lockAlias;
    }

    public void setLockAlias(String lockAlias) {
        this.lockAlias = lockAlias;
    }

    public String getKeyStatus() {
        return this.keyStatus;
    }

    public void setKeyStatus(String keyStatus) {
        this.keyStatus = keyStatus;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.accessToken);
        dest.writeString(this.keyStatus);
        dest.writeString(this.lockId);
        dest.writeString(this.keyId);
        dest.writeByte(this.isAdmin ? (byte) 1 : (byte) 0);
        dest.writeString(this.lockVersion);
        dest.writeString(this.lockName);
        dest.writeString(this.lockAlias);
        dest.writeString(this.lockMac);
        dest.writeInt(this.battery);
        dest.writeInt(this.lockFlagPos);
        dest.writeString(this.adminPs);
        dest.writeString(this.unlockKey);
        dest.writeString(this.adminKeyboardPwd);
        dest.writeString(this.deletePwd);
        dest.writeString(this.pwdInfo);
        dest.writeLong(this.timestamp);
        dest.writeString(this.aesKeystr);
        dest.writeLong(this.startDate);
        dest.writeLong(this.endDate);
        dest.writeInt(this.specialValue);
        dest.writeInt(this.timezoneRawOffset);
        dest.writeString(this.modelNumber);
        dest.writeString(this.hardwareRevision);
        dest.writeString(this.firmwareRevision);

        dest.writeString(this.user_type);
        dest.writeString(this.status);
        dest.writeString(this.push);
        dest.writeString(this.house_no);
        dest.writeString(this.types);
        dest.writeString(this.lock_type);
        dest.writeString(this.has_valid_rent);
        dest.writeString(this.reset_rent_pass);
    }

    protected Key(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.accessToken = in.readString();
        this.keyStatus = in.readString();
        this.lockId = in.readString();
        this.keyId = in.readString();
        this.isAdmin = in.readByte() != 0;
        this.lockVersion = in.readString();
        this.lockName = in.readString();
        this.lockAlias = in.readString();
        this.lockMac = in.readString();
        this.battery = in.readInt();
        this.lockFlagPos = in.readInt();
        this.adminPs = in.readString();
        this.unlockKey = in.readString();
        this.adminKeyboardPwd = in.readString();
        this.deletePwd = in.readString();
        this.pwdInfo = in.readString();
        this.timestamp = in.readLong();
        this.aesKeystr = in.readString();
        this.startDate = in.readLong();
        this.endDate = in.readLong();
        this.specialValue = in.readInt();
        this.timezoneRawOffset = in.readInt();
        this.modelNumber = in.readString();
        this.hardwareRevision = in.readString();
        this.firmwareRevision = in.readString();

        this.user_type = in.readString();
        this.status = in.readString();
        this.push = in.readString();
        this.house_no = in.readString();
        this.types = in.readString();
        this.lock_type = in.readString();
        this.has_valid_rent = in.readString();
        this.reset_rent_pass = in.readString();
    }

    public static final Parcelable.Creator<Key> CREATOR = new Parcelable.Creator<Key>() {
        @Override
        public Key createFromParcel(Parcel source) {
            return new Key(source);
        }

        @Override
        public Key[] newArray(int size) {
            return new Key[size];
        }
    };
}
